Skip to content

DAC Street Boys - DAC Support for STM32 F3xx and F4xx#123

Open
oleglazari wants to merge 10 commits intomainfrom
feature/ol2764RIT/dac-support
Open

DAC Street Boys - DAC Support for STM32 F3xx and F4xx#123
oleglazari wants to merge 10 commits intomainfrom
feature/ol2764RIT/dac-support

Conversation

@oleglazari
Copy link
Copy Markdown
Contributor

Summary

This PR implements DAC support on STM32 F3xx and F4xx microcontrollers. The code follows the STM32 HAL initialization sequence, includes input validation by clamping DAC values to a 12-bit maximum (4095), and supports both device families. This implementation will make DAC functionality easier to maintain and extend.

Why is it useful? idk safety i guess

Changes

  • Added DAC initialization compliant with STM32 HAL for F3xx and F4xx.
  • Implemented input validation to clamp input values to 4095.
  • Verified successful compilation on both F3xx and F4xx targets.

removed dac samples i made in my dreams

refactored dac to be more like adc

lowkey forgot externs

lowkey got rid of useless extern + comments

dac doc

added dac sample

Squashed dac changes
@oleglazari oleglazari requested a review from a team September 23, 2025 09:24
@oleglazari oleglazari marked this pull request as draft September 23, 2025 09:37
@oleglazari oleglazari marked this pull request as ready for review September 29, 2025 23:51
Copy link
Copy Markdown
Contributor

@DiegoLHendrix DiegoLHendrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

static bool checkSupport(DACPeriph periph, Channel_Support channelStruct);

void initDAC();
void initGPIO();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add descriptions for these methods

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chat these methods are like not worth documenting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am with Diego on this, add at least a little description.

Copy link
Copy Markdown
Member

@ActuallyTaylor ActuallyTaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great! However, I do have some recommendations for using #define, and some doc changes.

Copy link
Copy Markdown
Contributor

@mjh9585 mjh9585 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bunch of nitpicks, but a good start. You are missing a DAC on the STM32F334 so you will need to add multi-dac support on F3.

static bool checkSupport(DACPeriph periph, Channel_Support channelStruct);

void initDAC();
void initGPIO();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am with Diego on this, add at least a little description.

oleglazari and others added 4 commits October 18, 2025 10:32
- Fix DAC macro naming conflict by using DigitalToAnalogConverter typedef
- Replace all magic numbers with named constants in DAC sample
- Add comprehensive function documentation for sample test functions
- Improve code maintainability and readability
- All build issues resolved, ready for merge
- Add conditional compilation for DAC2 support
- STM32F302x8 only supports DAC1, STM32F334x8 supports both DAC1 and DAC2
- Use preprocessor directives to handle variant differences
- Fixes build errors on STM32F302x8 while maintaining full functionality on STM32F334x8
- Resolves mjh9585's comment about missing DAC support on F334 variants
@oleglazari oleglazari requested a review from mjh9585 November 11, 2025 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants